package com.jia.videos.controller;


import com.jia.videos.common.lang.R;
import com.jia.videos.entity.LittleVideo;
import com.jia.videos.service.LittleVideoService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dujiajia
 * @since 2020-12-23
 */
@RestController
@RequestMapping("/videos/littleVideo")
@CrossOrigin
@Api(tags = "小视频管理")
public class LittleVideoController {

    @Autowired
    LittleVideoService littleVideoService;

    @GetMapping("list")
    public R list() {
        List<LittleVideo> list = littleVideoService.list();
        return R.ok().data("data",list);
    }

    @GetMapping("pageList")
    public R pageList(@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
        Map<String, Object> pageList = littleVideoService.getPageList(pageNum, pageSize);
        return R.ok().data(pageList);
    }

}

